import {
  CallLimitDetailInfo,
  CallLimitSwitchInfo,
  SmsChannelInfo,
} from 'admin/schema/CorporateSet';
import $http from '../../../servers/http';
import { Result } from '../../schema/Result';
const mockApi = '';
// const mockApi = 'http://172.30.66.94:3000/mock/29';

/**查询呼叫频次限制配置 */
export const queryCallLimitSwitch = (): Promise<Result<CallLimitSwitchInfo>> => {
  return $http.get({
    url: mockApi + '/icms/systemconfig/companysettings/callFrequencyLimit/switch',
  });
};

/**设置呼叫频次限制配置 */
export const updateCallLimitSwitch = (data: CallLimitSwitchInfo): Promise<Result<null>> => {
  return $http.patch({
    url: mockApi + '/icms/systemconfig/companysettings/callFrequencyLimit/switch',
    data,
  });
};

/**呼叫频次限制-查询 */
export const queryCallLimitDetail = (): Promise<Result<CallLimitDetailInfo>> => {
  return $http.get({
    url: mockApi + '/icms/systemconfig/companysettings/callFrequencyLimit',
  });
};

/**呼叫频次限制-修改 */
export const updateCallLimitDetail = (data: CallLimitDetailInfo): Promise<Result<null>> => {
  return $http.put({
    url: mockApi + '/icms/systemconfig/companysettings/callFrequencyLimit',
    data,
  });
};

/**短信通道列表-查询 */
export const querySmsChannelList = (): Promise<Result<SmsChannelInfo[]>> => {
  return $http.get({
    url: mockApi + '/smstemplatemanage/smstemplates/smsGateway',
  });
};

/**短信通道详情-查询 */
export const querySmsChannelDetail = (): Promise<Result<SmsChannelInfo>> => {
  return $http.get({
    url: mockApi + '/icms/systemconfig/companysettings/smsGateway',
  });
};

/**短信通道详情-修改 */
export const updateSmsChannel = (data: { smsGatewayId: number }): Promise<Result<null>> => {
  return $http.put({
    url: mockApi + '/icms/systemconfig/companysettings/smsGateway',
    data,
  });
};
